package zhongbo.java.air.flightpath.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@ApiModel("轨迹信息")
@TableName("air_flight_path")
public class AirFlightPath implements Serializable {

    @TableId(type = IdType.ASSIGN_UUID)
    @ApiModelProperty("主键id")
    @Size(min = 1, max = 36, message = "主键长度是1~36的UUID")
    @NotNull(message = "主键不能为空")
    private String id;

    @ApiModelProperty(value = "关联飞机ICAO码", example = "001")
    @TableField("icao_code")
    @Size(min = 1, max = 6, message = "关联飞机ICAO码长度是1~6")
    @NotNull(message = "关联飞机ICAO码不能为空")
    private String icaoCode;

    @ApiModelProperty(value = "时间戳（精确到毫秒）",example = "2025-03-31 16:29:30.011")
    @TableField("timestamp")
    @PastOrPresent(message = "时间戳必须是过去或现在")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
    private Date timestamp;


    @ApiModelProperty(value = "纬度",example = "11.000001")
    @TableField("latitude")
    @Size(min = 0, max = 9, message = "纬度长度是1~9")
    @NotNull(message = "纬度不能为空")
    private Double latitude;

    @ApiModelProperty(value = "经度",example = "11.000001")
    @TableField("longitude")
    @Size(min = 0, max = 9, message = "经度长度是1~9")
    @NotNull(message = "经度不能为空")
    private Double longitude;

    @ApiModelProperty(value = "海拔高度",example = "8848.48")
    @TableField("altitude")
    @NotNull(message = "海拔高度不能为空")
    private Integer altitude;

    @ApiModelProperty(value = "地速（km/h）",example = "1")
    @TableField("speed")
    private Short speed;

    @ApiModelProperty(value = "航向角（0-359°）",example = "1")
    @TableField("heading")
    private Short heading;

    @ApiModelProperty(value = "数据源类型",example = "ADS_B")
    @TableField("source_type")
    @NotNull(message = "数据源类型不得为空")
    @Pattern(regexp = "^(ADS_B|RADAR|MLAT)$", message = "状态必须是 ADS_B, RADAR 或 MLAT")
    private String sourceType;
}
